﻿#region Using Directives

    using System;
    using System.Collections.Generic;

#endregion

namespace MarketPulse.BusinessLogic.Legacy
{
 

    #region Section Class

        /// <summary>
        /// Class used to represent a section containing questions
        /// </summary>
        public class Section
        {
            #region Constructors

                /// <summary>
                /// Default constructor for this class
                /// </summary>
                public Section()
                {
                    ID = 0;
                    Name = "Section Name";
                    DisplayOrder = 0;
                    DisplayNumber = 1;
                    PageID = 0;
                }
                            
                /// <summary>
                /// Overloaded constructor for this class that accepts and sets a list of parameters
                /// </summary>
                /// <param name="id">The ID for this section</param>
                /// <param name="name">The name to display for this section</param>
                /// <param name="displayOrder">The order in which to display this section</param>
                /// <param name="displayNumber">The visible number for this section</param>
                /// <param name="pageID">The page this section should be displayed on</param>
                public Section(int id, string name, int displayOrder, int displayNumber, int pageID)
                {
                    ID = id;
                    Name = name;
                    DisplayOrder = displayOrder;
                    DisplayNumber = displayNumber;
                    PageID = PageID;
                }

            #endregion

            #region Properties

                /// <summary>The ID for this section</summary>
                public int ID { get; set; }

                /// <summary>The name for this section</summary>
                public string Name { get; set; }

                /// <summary>The order in which to display this section</summary>
                public int DisplayOrder { get; set; }

                /// <summary>The visible number for this section</summary>
                public int DisplayNumber { get; set; }

                /// <summary>The page this section should be displayed on</summary>
                public int PageID { get; set; }

            #endregion
        }

    #endregion

    #region SectionCollection Class

                    /// <summary>
                    /// Class used to represent a collection of Question items
                    /// </summary>
                    public class SectionCollection : List<Section>
                    {
                        #region Methods

                            /// <summary>
                            /// Method used to find a specific set of sections based on the Page ID supplied
                            /// </summary>
                            /// <param name="number">The number of the page to find sections for</param>
                            /// <returns>A valid subset of sections</returns>
                            public List<Section> FindByPageID(int id)
                            {
                                //SectionCollection returnValue = new SectionCollection();

                                List<Section> returnValue = this.FindAll(delegate(Section section)
                                {
                                    return (section.PageID == id);
                                });                                

                                //var returnValue = this.FindAll(s => s.PageID == id);

                                return returnValue;                                
                            }                            

                        #endregion                       

                    }

                #endregion
  
}
